<include file="public@header"/>
<style>
.table img{
	width:25px;
	height:25px;
}

#pop{
    display:none; 
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>列表</a></li>
        <if condition='$type eq 0'>
        <li><a href="{:url('users/add')}">{:lang('ADD')}</a></li>
        </if>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('users/index')}">
        禁用：
        <select class="form-control" name="isban">
            <option value="">全部</option>
                <option value="1" <if condition="input('request.isban') neq '' && input('request.isban') eq 1">selected</if>>是</option>
                <option value="0" <if condition="input('request.isban') neq '' && input('request.isban') eq 0">selected</if>>否</option>
        </select>

        注册时间：
        <input class="form-control js-bootstrap-date" name="start_time" id="start_time" value="{:input('request.start_time')}" aria-invalid="false" style="width: 110px;"> - 
        <input class="form-control js-bootstrap-date" name="end_time" id="end_time" value="{:input('request.end_time')}" aria-invalid="false" style="width: 110px;">
            
        用户ID：
        <input class="form-control" type="text" name="uid" style="width: 200px;" value="{:input('request.uid')}"
               placeholder="请输入用户ID">
        关键字：
        <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
               placeholder="用户名/昵称">
        <input type="hidden" name="type" value="{$type}"/>
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('users/index',['type'=>$type])}">清空</a>
        <br>
        <br>
        用户数：{$nums}  (根据条件统计)
    </form>
    <form method="post" class="js-ajax-form" action="{:url('users/listOrder')}">

        <table class="table table-hover table-bordered">
            <thead>
            <tr>

                <th>ID</th>
                <th>用户名</th>
                <th>昵称</th>
                <th>头像</th>
                <th>手机</th>
                <th>余额</th>
                <th>累计消费</th>
                <th>注册时间</th>
                <th>{:lang('STATUS')}</th>
                <th>{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <php>
                $user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));
            </php>
            <foreach name="list" item="vo">
                <tr>

                    <td>{$vo.id}</td>
                    <td>{$vo['user_login']?$vo['user_login']:($vo['mobile']?$vo['mobile']:lang('THIRD_PARTY_USER'))}
                    </td>
                    <td>{$vo['user_nickname'] ? $vo['user_nickname'] : '暂无'}</td>
                    <td><img src="{$vo['avatar']}"/></td>
                    <td>{$vo.mobile}</td>
                    <td>{$vo.coin}</td>
                    <td>{$vo.consumption}</td>
                    <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
                    <td>
                        
                        <if condition="$vo.user_status eq 0">
                            <span class="label label-danger">{$user_statuses[0]}</span>
                        <else/>
                            <span class="label label-success">{$user_statuses[1]}</span>
                        </if>
                        
                    </td>
                    <td>
                        <if condition="($vo.id != 27) && ($vo.id != 1)">
                            <if condition="$vo.user_status eq 0">
                                <a class="btn btn-xs btn-success js-ajax-dialog-btn"
                                       href="{:url('users/cancelban',array('id'=>$vo['id']))}"
                                       data-msg="{:lang('ACTIVATE_USER_CONFIRM_MESSAGE')}">{:lang('ACTIVATE_USER')}</a>
                            <else/>
                                
                                <a class="btn btn-xs btn-warning js-ajax-dialog-btn"
                                       href="{:url('users/ban',array('id'=>$vo['id']))}"
                                       data-msg="{:lang('BLOCK_USER_CONFIRM_MESSAGE')}">禁用</a>
                            </if>
                            <input type="hidden" name="id" id="id" value="{$vo.id}" />
                            <if condition="$vo.type eq 1">
                                <a class="btn btn-xs btn-warning js-ajax-dialog-btn" href="{:url('users/cancelTeacher',array('id'=>$vo['id']))}">取消讲师</a>
                                
                            <else/>
                                <a class="btn btn-xs btn-info js-ajax-dialog-btn" href="{:url('admin/users/setSignory', ['id' => $vo['id']])}">设置为讲师</a>
                            </if>
    
                            <a class="btn btn-xs btn-primary" href='{:url("users/edit",array("id"=>$vo["id"]))}'>{:lang('EDIT')}</a>
                            <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('users/del',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
                        </if>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>

        <div class="pagination">{$page}</div>
    </form>
</div>

            
<script src="__STATIC__/js/admin.js"></script>

</body>
</html>